//轮播
var swiper = new Swiper('.swiper-container', {
	//小点
	pagination: {
		el: '.swiper-pagination',
	},
	//按钮
	navigation: {
		nextEl: '.swiper-button-next',
		prevEl: '.swiper-button-prev',
	},
	//无缝轮播
	loop: true
});

//楼层
//获取#top
var floor = document.querySelectorAll(".nav-item");
window.onscroll = function() {
	var height = document.documentElement.scrollTop || document.body.scrollTop;
	console.log(height);

	for(var h = 0; h < floor.length; h++) {
		floor[h].classList.remove('active');
		if(height >= 0 && height < 399) {
			floor[0].classList.add('active');
		} else if(height >= 399 && height < 900) {
			floor[1].classList.add('active');
		} else if(height >= 900 && height < 1300) {
			floor[2].classList.add('active');
		} else if(height >= 1300 && height < 1700) {
			floor[3].classList.add('active');
		} else {
			floor[4].classList.add('active');
		}
	}

}

floor[0].addEventListener('click', function() {
	floor[0].classList.add('active');
	window.scrollTo({
		top: 0,
		behavior: 'smooth'
	})
})
floor[1].addEventListener('click', function() {
	floor[1].classList.add('active');
	window.scrollTo({
		top: 399,
		behavior: 'smooth'
	})
})
floor[2].addEventListener('click', function() {
	floor[2].classList.add('active');
	window.scrollTo({
		top: 900,
		behavior: 'smooth'
	})
})
floor[3].addEventListener('click', function() {
	floor[3].classList.add('active');
	window.scrollTo({
		top: 1300,
		behavior: 'smooth'
	})
})
floor[4].addEventListener('click', function() {
	floor[4].classList.add('active');
	window.scrollTo({
		top: 1700,
		behavior: 'smooth'
	})
})